package UML_ER.diagram.edit.parts;

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

import org.eclipse.draw2d.Connection;
import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.handles.MoveHandle;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.notation.View;

import UML_ER.diagram.edit.commands.BinaryRelationshipTargetCreateCommand;
import UML_ER.diagram.edit.parts.EntityEditPart.EntityFigure;
import UML_ER.diagram.edit.policies.BinaryRelationship2ItemSemanticEditPolicy;
import UML_ER.diagram.edit.policies.EntityItemSemanticEditPolicy;
import UML_ER.diagram.edit.policies.NonResizableBinaryRelationshipEditPolicy;
import UML_ER.diagram.providers.UML_ERElementTypes;

/**
 * @generated
 */
public class BinaryRelationship2EditPart extends ConnectionNodeEditPart
		implements ITreeBranchEditPart {

	/**
	 * @generated
	 */
	public static final int VISUAL_ID = 4014;

	/**
	 * @generated
	 */
	public BinaryRelationship2EditPart(View view) {
		super(view);
	}

	private Connection connection;

	/**
	 * 
	 */
	protected void createDefaultEditPolicies() {
		super.createDefaultEditPolicies();
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
				new BinaryRelationship2ItemSemanticEditPolicy());
		installEditPolicy(EditPolicyRoles.CREATION_ROLE,
				new CreationEditPolicy());
	}

	/**
	 * Creates figure for this edit part.
	 * 
	 * Body of this method does not depend on settings in generation model
	 * so you may safely remove <i>generated</i> tag and modify it.
	 * 
	 * 
	 */
	protected Connection createConnectionFigure() {
		return connection = new RelationshipFigure();
	}

	/**
	 * @generated
	 */
	public RelationshipFigure getPrimaryShape() {
		return (RelationshipFigure) getFigure();
	}

	/**
	 * @generated
	 */
	public class RelationshipFigure extends PolylineConnectionEx {

		/**
		 * @generated
		 */
		public RelationshipFigure() {
			this.setLineWidth(2);

		}

	}

}